import log from '@dfeidao/atom-nodejs/logger/log';
import operate from '@dfeidao/atom-nodejs/db/operate';
import { systemid } from '../../atom/config';

interface Message {
	filter: {
		_id: string;
		cust_name: string;
		contact_address: string;
		memo: string;
		industry_domain_no: string;
		industry_domain_name: string;


	};
}

export default async function atom(msg: Message, action_id: string, session_id: string) {
	log('Service begin');
	// todo
	const { update, exec } = operate(action_id, session_id, systemid);
	update('pub_client', { "_id": msg.filter._id }, { "cust_name": msg.filter.cust_name, "contact_address": msg.filter.contact_address, "industry_domain_no": msg.filter.industry_domain_no, "memo": msg.filter.memo, "industry_domain_name": msg.filter.industry_domain_name });
	const res = await exec();

	log('Service end');
	return res;
}
